/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.violetPrinciple.OCP;

/**
 *
 * @author Oceanwave
 */
public class Counter 
{
    int days,hours, minutes, seconds;

    public void setCurrentTime(int days, int hours, int minutes, int seconds)
    {
        this.hours = hours;
        this.minutes = minutes;
        this.seconds = seconds;
        this.days = days;
    }
    
    public void addTime(int initDays, int initHours, int initMins, int initSeconds)
    {
        days += initDays;
        hours += initHours;
        minutes += initMins;
        seconds += initSeconds;
        int numRemAdd = 0;
        
        if (seconds >= 60)
        {
            numRemAdd = seconds / 60;
            minutes += numRemAdd;
            seconds = seconds - (numRemAdd * 60);
        }
        
        if (minutes >= 60)
        {
            numRemAdd = minutes / 60;
            hours += numRemAdd;
            minutes = minutes - (numRemAdd * 60);
        }
        
        if (hours >= 24)
        {
            numRemAdd = hours / 24;
            days += numRemAdd;
            hours = hours - (numRemAdd * 24);
        }   
    }
    
    public void displayTime()
    {
        System.out.println("Days: " + days + "Hours " + hours + "Minutes: " + minutes + "Seconds" + seconds);
    }

}
